<?php
namespace app\admin\model;

use think\Model;

class Order extends Model
{
    protected $table = 'order';
    protected $autoWriteTimestamp = 'datetime';

    public function memberAddress(){

        return $this->hasOne('MemberAddress','id','address_id');

    }

    public function getStatusAttr($val)
    {
        switch ($val){
            case 1;
                return '待确认';
                break;
            case 2:
                return '已确认';
                break;
            case 3:
                return '已发货';
                break;
            case 4:
                return '待收货';
                break;
            case 5:
                return '已完成';
                break;
            default:
                return '已失效';
                break;
        }
        
    }

}